package com.dries.portal.module.portal.controller;

import com.dries.common.api.CommonResult;
import com.dries.portal.module.portal.entity.DiscussReply;
import com.dries.portal.module.portal.service.IDiscussReplyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Map;

/**
 * 用户评价回复表
 *
 * @author dries
 * @email samphsanie@gmail.com
 * @date 2020-08-07 13:37:45
 */
@RestController
@Api(tags = "用户评价回复API", value = "DiscussReplyController")
@RequestMapping("/portal/discuss/reply")
public class DiscussReplyController {

    @Resource
    private IDiscussReplyService discussReplyService;

    /**
     * 列表
     */
    @GetMapping("/list")
    public CommonResult list(@RequestParam Map<String, Object> params) {
        return CommonResult.success();
    }


    /**
     * 信息
     */
    @GetMapping("/info/{id}")
    public CommonResult info(@PathVariable("id") Integer id) {
        DiscussReply discussReply = discussReplyService.getById(id);

        return CommonResult.success();
    }

    /**
     * 保存
     */
    @ApiOperation("新增评论回复")
    @PostMapping("/save")
    public CommonResult save(@RequestBody DiscussReply discussReply) {
        discussReplyService.save(discussReply);

        return CommonResult.success();
    }

    /**
     * 修改
     */
    @PutMapping("/update")
    public CommonResult update(@RequestBody DiscussReply discussReply) {
        discussReplyService.updateById(discussReply);

        return CommonResult.success();
    }

    /**
     * 删除
     */
    @DeleteMapping("/delete")
    public CommonResult delete(@RequestBody Integer[] ids) {
        discussReplyService.removeByIds(Arrays.asList(ids));

        return CommonResult.success();
    }

}
